<template>
  <el-card>
    <tag-display v-if="model && model.id" :content="content" :label-type="model.labelType" :code-position="model.codePosition" :code="code"></tag-display>
  </el-card>
</template>

<script setup>

import TagDisplay from "@/components/Asset/TagDisplay.vue";
import Constants from "@/views/asset/settings/tag/constants.js";

const props = defineProps({
  // 数据
  data: {
    type: Object,
    default: () => {}
  },
  // 模板
  model: {
    type: Object,
    default: () => {
      return {
        id: null
      }
    }
  }
})

const code = computed(()=> {
  debugger
  return props.data.number;
});

const content = computed(()=> {
  const model = props.model;
  const fields = model.fields;
  if (!fields) {
    return [];
  }

  const fieldListAll = Constants.fieldListAll;
  return fields.split(',').map(item=> {
    const findField = fieldListAll.find(field=> {
      return field.value === item;
    });
    let label = null;
    if (findField) {
      label = findField.label;
    }
    return {
      name: label,
      value: props.data[item]
    }

  })
});


</script>

<style scoped lang="scss">

</style>

